package net.canang.codegen.engine.domain;

import org.apache.velocity.util.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * todo: comment
 */
public class Model {


    private List<Property> properties;
    private String name;
    private String javaName;
    private String pluralJavaName;
    private String beanName;
    private String pluralName;
    private String description;
    private Domain domain;
    private String alias;
    private Map options;
    private Model inheritedFromModel;

    public Model(Domain domain) {
        this.domain = domain;
        this.properties = new ArrayList<Property>();
    }

    public List<Property> getProperties() {
        return properties;
    }

    public void setProperties(List<Property> properties) {
        this.properties = properties;
    }

    public void addProperty(Property property) {
        property.setModel(this);
        this.properties.add(property);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        this.javaName = StringUtils.firstLetterCaps(name);
        this.beanName = StringUtils.firstLetterCaps(name) + "Bean";
        this.pluralName = name + "s"; // if doesnt not end in letter y
        this.pluralJavaName = javaName + "s"; // if doesnt not end in letter y
    }

    public String getJavaName() {
        return javaName;
    }

    public void setJavaName(String javaName) {
        this.javaName = javaName;
    }

    public String getPluralJavaName() {
        return pluralJavaName;
    }

    public void setPluralJavaName(String pluralJavaName) {
        this.pluralJavaName = pluralJavaName;
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public String getPluralName() {
        return pluralName;
    }


    public void setPluralName(String pluralName) {
        this.pluralName = pluralName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Domain getDomain() {
        return domain;
    }

    public void setDomain(Domain domain) {
        this.domain = domain;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public Map getOptions() {
        return options;
    }

    public void setOptions(Map options) {
        this.options = options;
    }

    public Model getInheritedFromModel() {
        return inheritedFromModel;
    }

    public void setInheritedFromModel(Model inheritedFromModel) {
        this.inheritedFromModel = inheritedFromModel;
    }

}
